﻿#ifndef CONNECTMANAGER_H
#define CONNECTMANAGER_H

#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QSqlRecord>

#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include <QDateTime>

#include "modbuscontrol.h"
#include "printercontrol.h"
#include "scannercontrol.h"

// 报警信号信息
typedef struct S_WARNSIGNALINFO{
    QDateTime startDateTime;        // 开始如阐明
    QString startDate;      // 格式化后的年月日
    QString startTime;      // 格式化后的时分秒
    QString endTime;        // 报警结束时间
    QString discription;    // 报警信号信息
    QString durationtime;   // 报警持续时间
}WARNSIGNALINFO;


class ConnectManager : public QObject
{
    Q_OBJECT

    // 串口信息
    Q_PROPERTY(QStringList serialInfo READ serialInfo WRITE setSerialInfo NOTIFY serialInfoChanged FINAL)
    // ModBus连接状态
    Q_PROPERTY(bool modbusState READ modbusState WRITE setModbusState NOTIFY modbusStateChanged FINAL)

    // 页面 - 页码
    Q_PROPERTY(int qmlPage READ qmlPage WRITE setQmlPage NOTIFY qmlPageChanged FINAL)

    // 当前位置
    Q_PROPERTY(QString knifeCurrLocation READ knifeCurrLocation WRITE setKnifeCurrLocation NOTIFY knifeCurrLocationChanged FINAL)
    Q_PROPERTY(QString rollerCurrLocation READ rollerCurrLocation WRITE setRollerCurrLocation NOTIFY rollerCurrLocationChanged FINAL)
    Q_PROPERTY(QString stress01CurrLocation READ stress01CurrLocation WRITE setStress01CurrLocation NOTIFY stress01CurrLocationChanged FINAL)
    Q_PROPERTY(QString stress02CurrLocation READ stress02CurrLocation WRITE setStress02CurrLocation NOTIFY stress02CurrLocationChanged FINAL)
    Q_PROPERTY(QString stress03CurrLocation READ stress03CurrLocation WRITE setStress03CurrLocation NOTIFY stress03CurrLocationChanged FINAL)
    Q_PROPERTY(QString f_knife01CurrLocation READ f_knife01CurrLocation WRITE setF_knife01CurrLocation NOTIFY f_knife01CurrLocationChanged FINAL)
    Q_PROPERTY(QString f_knife02CurrLocation READ f_knife02CurrLocation WRITE setF_knife02CurrLocation NOTIFY f_knife02CurrLocationChanged FINAL)
    Q_PROPERTY(QString f_knife03CurrLocation READ f_knife03CurrLocation WRITE setF_knife03CurrLocation NOTIFY f_knife03CurrLocationChanged FINAL)
    Q_PROPERTY(QString b_knife01CurrLocation READ b_knife01CurrLocation WRITE setB_knife01CurrLocation NOTIFY b_knife01CurrLocationChanged FINAL)
    Q_PROPERTY(QString b_knife02CurrLocation READ b_knife02CurrLocation WRITE setB_knife02CurrLocation NOTIFY b_knife02CurrLocationChanged FINAL)
    Q_PROPERTY(QString b_knife03CurrLocation READ b_knife03CurrLocation WRITE setB_knife03CurrLocation NOTIFY b_knife03CurrLocationChanged FINAL)

    // 目标位置
    Q_PROPERTY(QString knifeAimLocation READ knifeAimLocation WRITE setKnifeAimLocation NOTIFY knifeAimLocationChanged FINAL)
    Q_PROPERTY(QString rollerAimLocation READ rollerAimLocation WRITE setRollerAimLocation NOTIFY rollerAimLocationChanged FINAL)
    Q_PROPERTY(QString stress01AimLocation READ stress01AimLocation WRITE setStress01AimLocation NOTIFY stress01AimLocationChanged FINAL)
    Q_PROPERTY(QString stress02AimLocation READ stress02AimLocation WRITE setStress02AimLocation NOTIFY stress02AimLocationChanged FINAL)
    Q_PROPERTY(QString stress03AimLocation READ stress03AimLocation WRITE setStress03AimLocation NOTIFY stress03AimLocationChanged FINAL)
    Q_PROPERTY(QString f_knife01AimLocation READ f_knife01AimLocation WRITE setF_knife01AimLocation NOTIFY f_knife01AimLocationChanged FINAL)
    Q_PROPERTY(QString f_knife02AimLocation READ f_knife02AimLocation WRITE setF_knife02AimLocation NOTIFY f_knife02AimLocationChanged FINAL)
    Q_PROPERTY(QString f_knife03AimLocation READ f_knife03AimLocation WRITE setF_knife03AimLocation NOTIFY f_knife03AimLocationChanged FINAL)
    Q_PROPERTY(QString b_knife01AimLocation READ b_knife01AimLocation WRITE setB_knife01AimLocation NOTIFY b_knife01AimLocationChanged FINAL)
    Q_PROPERTY(QString b_knife02AimLocation READ b_knife02AimLocation WRITE setB_knife02AimLocation NOTIFY b_knife02AimLocationChanged FINAL)
    Q_PROPERTY(QString b_knife03AimLocation READ b_knife03AimLocation WRITE setB_knife03AimLocation NOTIFY b_knife03AimLocationChanged FINAL)

    // 待命点位置
    Q_PROPERTY(QString knifeStandby READ knifeStandby WRITE setKnifeStandby NOTIFY knifeStandbyChanged FINAL)
    Q_PROPERTY(QString rollerStandby READ rollerStandby WRITE setRollerStandby NOTIFY rollerStandbyChanged FINAL)
    Q_PROPERTY(QString stress01Standby READ stress01Standby WRITE setStress01Standby NOTIFY stress01StandbyChanged FINAL)
    Q_PROPERTY(QString stress02Standby READ stress02Standby WRITE setStress02Standby NOTIFY stress02StandbyChanged FINAL)
    Q_PROPERTY(QString stress03Standby READ stress03Standby WRITE setStress03Standby NOTIFY stress03StandbyChanged FINAL)
    Q_PROPERTY(QString f_knife01Standby READ f_knife01Standby WRITE setF_knife01Standby NOTIFY f_knife01StandbyChanged FINAL)
    Q_PROPERTY(QString f_knife02Standby READ f_knife02Standby WRITE setF_knife02Standby NOTIFY f_knife02StandbyChanged FINAL)
    Q_PROPERTY(QString f_knife03Standby READ f_knife03Standby WRITE setF_knife03Standby NOTIFY f_knife03StandbyChanged FINAL)
    Q_PROPERTY(QString b_knife01Standby READ b_knife01Standby WRITE setB_knife01Standby NOTIFY b_knife01StandbyChanged FINAL)
    Q_PROPERTY(QString b_knife02Standby READ b_knife02Standby WRITE setB_knife02Standby NOTIFY b_knife02StandbyChanged FINAL)
    Q_PROPERTY(QString b_knife03Standby READ b_knife03Standby WRITE setB_knife03Standby NOTIFY b_knife03StandbyChanged FINAL)

    // 定位位置
    Q_PROPERTY(QString knifeLocation READ knifeLocation WRITE setKnifeLocation NOTIFY knifeLocationChanged FINAL)
    Q_PROPERTY(QString rollerLocation READ rollerLocation WRITE setRollerLocation NOTIFY rollerLocationChanged FINAL)
    Q_PROPERTY(QString stress01Location READ stress01Location WRITE setStress01Location NOTIFY stress01LocationChanged FINAL)
    Q_PROPERTY(QString stress02Location READ stress02Location WRITE setStress02Location NOTIFY stress02LocationChanged FINAL)
    Q_PROPERTY(QString stress03Location READ stress03Location WRITE setStress03Location NOTIFY stress03LocationChanged FINAL)
    Q_PROPERTY(QString f_knife01Location READ f_knife01Location WRITE setF_knife01Location NOTIFY f_knife01LocationChanged FINAL)
    Q_PROPERTY(QString f_knife02Location READ f_knife02Location WRITE setF_knife02Location NOTIFY f_knife02LocationChanged FINAL)
    Q_PROPERTY(QString f_knife03Location READ f_knife03Location WRITE setF_knife03Location NOTIFY f_knife03LocationChanged FINAL)
    Q_PROPERTY(QString b_knife01Location READ b_knife01Location WRITE setB_knife01Location NOTIFY b_knife01LocationChanged FINAL)
    Q_PROPERTY(QString b_knife02Location READ b_knife02Location WRITE setB_knife02Location NOTIFY b_knife02LocationChanged FINAL)
    Q_PROPERTY(QString b_knife03Location READ b_knife03Location WRITE setB_knife03Location NOTIFY b_knife03LocationChanged FINAL)

    // 手动速率比例
    Q_PROPERTY(QString manualSpeedRate READ manualSpeedRate WRITE setManualSpeedRate NOTIFY manualSpeedRateChanged FINAL)

    // 变频器速度
    Q_PROPERTY(QString transducerSpeed READ transducerSpeed WRITE setTransducerSpeed NOTIFY transducerSpeedChanged FINAL)

    // 输入输出 - 离散输入
    Q_PROPERTY(bool knifeA READ knifeA WRITE setKnifeA NOTIFY knifeAChanged FINAL)
    Q_PROPERTY(bool knifeB READ knifeB WRITE setKnifeB NOTIFY knifeBChanged FINAL)
    Q_PROPERTY(bool rollerA READ rollerA WRITE setRollerA NOTIFY rollerAChanged FINAL)
    Q_PROPERTY(bool rollerB READ rollerB WRITE setRollerB NOTIFY rollerBChanged FINAL)
    Q_PROPERTY(bool scramBtn READ scramBtn WRITE setScramBtn NOTIFY scramBtnChanged FINAL)
    Q_PROPERTY(bool rollerOrigin READ rollerOrigin WRITE setRollerOrigin NOTIFY rollerOriginChanged FINAL)
    Q_PROPERTY(bool knifeUpLmt READ knifeUpLmt WRITE setKnifeUpLmt NOTIFY knifeUpLmtChanged FINAL)
    Q_PROPERTY(bool knifeDownLmt READ knifeDownLmt WRITE setKnifeDownLmt NOTIFY knifeDownLmtChanged FINAL)
    Q_PROPERTY(bool transducerWarnning READ transducerWarnning WRITE setTransducerWarnning NOTIFY transducerWarnningChanged FINAL)
    Q_PROPERTY(bool knifeUpBtn READ knifeUpBtn WRITE setKnifeUpBtn NOTIFY knifeUpBtnChanged FINAL)
    Q_PROPERTY(bool knifeDownBtn READ knifeDownBtn WRITE setKnifeDownBtn NOTIFY knifeDownBtnChanged FINAL)
    Q_PROPERTY(bool rollerUpBtn READ rollerUpBtn WRITE setRollerUpBtn NOTIFY rollerUpBtnChanged FINAL)
    Q_PROPERTY(bool rollerDownBtn READ rollerDownBtn WRITE setRollerDownBtn NOTIFY rollerDownBtnChanged FINAL)

    // 输入输出 - 线圈
    Q_PROPERTY(bool knifeUpSignal READ knifeUpSignal WRITE setKnifeUpSignal NOTIFY knifeUpSignalChanged FINAL)
    Q_PROPERTY(bool knifeDownSignal READ knifeDownSignal WRITE setKnifeDownSignal NOTIFY knifeDownSignalChanged FINAL)
    Q_PROPERTY(bool rollerUpSignal READ rollerUpSignal WRITE setRollerUpSignal NOTIFY rollerUpSignalChanged FINAL)
    Q_PROPERTY(bool rollerDownSignal READ rollerDownSignal WRITE setRollerDownSignal NOTIFY rollerDownSignalChanged FINAL)
    Q_PROPERTY(bool manualControlSignal READ manualControlSignal WRITE setManualControlSignal NOTIFY manualControlSignalChanged FINAL)
    Q_PROPERTY(bool runningSignal READ runningSignal WRITE setRunningSignal NOTIFY runningSignalChanged FINAL)
    Q_PROPERTY(bool warnningSignal READ warnningSignal WRITE setWarnningSignal NOTIFY warnningSignalChanged FINAL)



    // 错误代码
    Q_PROPERTY(QString stress01_ErrCode READ stress01_ErrCode WRITE setStress01_ErrCode NOTIFY stress01_ErrCodeChanged FINAL)
    Q_PROPERTY(QString stress02_ErrCode READ stress02_ErrCode WRITE setStress02_ErrCode NOTIFY stress02_ErrCodeChanged FINAL)
    Q_PROPERTY(QString stress03_ErrCode READ stress03_ErrCode WRITE setStress03_ErrCode NOTIFY stress03_ErrCodeChanged FINAL)
    Q_PROPERTY(QString f_knife01_ErrCode READ f_knife01_ErrCode WRITE setF_knife01_ErrCode NOTIFY f_knife01_ErrCodeChanged FINAL)
    Q_PROPERTY(QString f_knife02_ErrCode READ f_knife02_ErrCode WRITE setF_knife02_ErrCode NOTIFY f_knife02_ErrCodeChanged FINAL)
    Q_PROPERTY(QString f_knife03_ErrCode READ f_knife03_ErrCode WRITE setF_knife03_ErrCode NOTIFY f_knife03_ErrCodeChanged FINAL)
    Q_PROPERTY(QString b_knife01_ErrCode READ b_knife01_ErrCode WRITE setB_knife01_ErrCode NOTIFY b_knife01_ErrCodeChanged FINAL)
    Q_PROPERTY(QString b_knife02_ErrCode READ b_knife02_ErrCode WRITE setB_knife02_ErrCode NOTIFY b_knife02_ErrCodeChanged FINAL)
    Q_PROPERTY(QString b_knife03_ErrCode READ b_knife03_ErrCode WRITE setB_knife03_ErrCode NOTIFY b_knife03_ErrCodeChanged FINAL)

    // 手动自动速度
    Q_PROPERTY(QString stressMaunalSpeed READ stressMaunalSpeed WRITE setStressMaunalSpeed NOTIFY stressMaunalSpeedChanged FINAL)
    Q_PROPERTY(QString stressAutoSpeed READ stressAutoSpeed WRITE setStressAutoSpeed NOTIFY stressAutoSpeedChanged FINAL)
    Q_PROPERTY(QString knifeManualSpeed READ knifeManualSpeed WRITE setKnifeManualSpeed NOTIFY knifeManualSpeedChanged FINAL)
    Q_PROPERTY(QString knifeAutoSpeed READ knifeAutoSpeed WRITE setKnifeAutoSpeed NOTIFY knifeAutoSpeedChanged FINAL)

    // 后刀偏移量
    Q_PROPERTY(QString b_knife01_Offset READ b_knife01_Offset WRITE setB_knife01_Offset NOTIFY b_knife01_OffsetChanged FINAL)
    Q_PROPERTY(QString b_knife02_Offset READ b_knife02_Offset WRITE setB_knife02_Offset NOTIFY b_knife02_OffsetChanged FINAL)
    Q_PROPERTY(QString b_knife03_Offset READ b_knife03_Offset WRITE setB_knife03_Offset NOTIFY b_knife03_OffsetChanged FINAL)

    // 原点位置
    Q_PROPERTY(QString knifeOriginLocation READ knifeOriginLocation WRITE setKnifeOriginLocation NOTIFY knifeOriginLocationChanged FINAL)
    Q_PROPERTY(QString rollerOriginLocation READ rollerOriginLocation WRITE setRollerOriginLocation NOTIFY rollerOriginLocationChanged FINAL)
    Q_PROPERTY(QString stress01OriginLocation READ stress01OriginLocation WRITE setStress01OriginLocation NOTIFY stress01OriginLocationChanged FINAL)
    Q_PROPERTY(QString stress02OriginLocation READ stress02OriginLocation WRITE setStress02OriginLocation NOTIFY stress02OriginLocationChanged FINAL)
    Q_PROPERTY(QString stress03OriginLocation READ stress03OriginLocation WRITE setStress03OriginLocation NOTIFY stress03OriginLocationChanged FINAL)
    Q_PROPERTY(QString f_knife01OriginLocation READ f_knife01OriginLocation WRITE setF_knife01OriginLocation NOTIFY f_knife01OriginLocationChanged FINAL)
    Q_PROPERTY(QString f_knife02OriginLocation READ f_knife02OriginLocation WRITE setF_knife02OriginLocation NOTIFY f_knife02OriginLocationChanged FINAL)
    Q_PROPERTY(QString f_knife03OriginLocation READ f_knife03OriginLocation WRITE setF_knife03OriginLocation NOTIFY f_knife03OriginLocationChanged FINAL)
    Q_PROPERTY(QString b_knife01OriginLocation READ b_knife01OriginLocation WRITE setB_knife01OriginLocation NOTIFY b_knife01OriginLocationChanged FINAL)
    Q_PROPERTY(QString b_knife02OriginLocation READ b_knife02OriginLocation WRITE setB_knife02OriginLocation NOTIFY b_knife02OriginLocationChanged FINAL)
    Q_PROPERTY(QString b_knife03OriginLocation READ b_knife03OriginLocation WRITE setB_knife03OriginLocation NOTIFY b_knife03OriginLocationChanged FINAL)

    // 限位位置
    Q_PROPERTY(QString knifeUpLimit READ knifeUpLimit WRITE setKnifeUpLimit NOTIFY knifeUpLimitChanged FINAL)
    Q_PROPERTY(QString knifeDownLimit READ knifeDownLimit WRITE setKnifeDownLimit NOTIFY knifeDownLimitChanged FINAL)
    Q_PROPERTY(QString rollerUpLimit READ rollerUpLimit WRITE setRollerUpLimit NOTIFY rollerUpLimitChanged FINAL)
    Q_PROPERTY(QString rollerDownLimit READ rollerDownLimit WRITE setRollerDownLimit NOTIFY rollerDownLimitChanged FINAL)
    Q_PROPERTY(QString stress01_F_Limit READ stress01_F_Limit WRITE setStress01_F_Limit NOTIFY stress01_F_LimitChanged FINAL)
    Q_PROPERTY(QString stress01_B_Limit READ stress01_B_Limit WRITE setStress01_B_Limit NOTIFY stress01_B_LimitChanged FINAL)
    Q_PROPERTY(QString stress02_F_Limit READ stress02_F_Limit WRITE setStress02_F_Limit NOTIFY stress02_F_LimitChanged FINAL)
    Q_PROPERTY(QString stress02_B_Limit READ stress02_B_Limit WRITE setStress02_B_Limit NOTIFY stress02_B_LimitChanged FINAL)
    Q_PROPERTY(QString stress03_F_Limit READ stress03_F_Limit WRITE setStress03_F_Limit NOTIFY stress03_F_LimitChanged FINAL)
    Q_PROPERTY(QString stress03_B_Limit READ stress03_B_Limit WRITE setStress03_B_Limit NOTIFY stress03_B_LimitChanged FINAL)
    Q_PROPERTY(QString f_knife01_UpLimit READ f_knife01_UpLimit WRITE setF_knife01_UpLimit NOTIFY f_knife01_UpLimitChanged FINAL)
    Q_PROPERTY(QString f_knife01_DownLimit READ f_knife01_DownLimit WRITE setF_knife01_DownLimit NOTIFY f_knife01_DownLimitChanged FINAL)
    Q_PROPERTY(QString f_knife02_UpLimit READ f_knife02_UpLimit WRITE setF_knife02_UpLimit NOTIFY f_knife02_UpLimitChanged FINAL)
    Q_PROPERTY(QString f_knife02_DownLimit READ f_knife02_DownLimit WRITE setF_knife02_DownLimit NOTIFY f_knife02_DownLimitChanged FINAL)
    Q_PROPERTY(QString f_knife03_UpLimit READ f_knife03_UpLimit WRITE setF_knife03_UpLimit NOTIFY f_knife03_UpLimitChanged FINAL)
    Q_PROPERTY(QString f_knife03_DownLimit READ f_knife03_DownLimit WRITE setF_knife03_DownLimit NOTIFY f_knife03_DownLimitChanged FINAL)
    Q_PROPERTY(QString b_knife01_UpLimit READ b_knife01_UpLimit WRITE setB_knife01_UpLimit NOTIFY b_knife01_UpLimitChanged FINAL)
    Q_PROPERTY(QString b_knife01_DownLimit READ b_knife01_DownLimit WRITE setB_knife01_DownLimit NOTIFY b_knife01_DownLimitChanged FINAL)
    Q_PROPERTY(QString b_knife02_UpLimit READ b_knife02_UpLimit WRITE setB_knife02_UpLimit NOTIFY b_knife02_UpLimitChanged FINAL)
    Q_PROPERTY(QString b_knife02_DownLimit READ b_knife02_DownLimit WRITE setB_knife02_DownLimit NOTIFY b_knife02_DownLimitChanged FINAL)
    Q_PROPERTY(QString b_knife03_UpLimit READ b_knife03_UpLimit WRITE setB_knife03_UpLimit NOTIFY b_knife03_UpLimitChanged FINAL)
    Q_PROPERTY(QString b_knife03_DownLimit READ b_knife03_DownLimit WRITE setB_knife03_DownLimit NOTIFY b_knife03_DownLimitChanged FINAL)

    // 补偿
    Q_PROPERTY(QString knife_UpCpst READ knife_UpCpst WRITE setKnife_UpCpst NOTIFY knife_UpCpstChanged FINAL)
    Q_PROPERTY(QString knife_DownCpst READ knife_DownCpst WRITE setKnife_DownCpst NOTIFY knife_DownCpstChanged FINAL)
    Q_PROPERTY(QString roller_UpCpst READ roller_UpCpst WRITE setRoller_UpCpst NOTIFY roller_UpCpstChanged FINAL)
    Q_PROPERTY(QString roller_DownCpst READ roller_DownCpst WRITE setRoller_DownCpst NOTIFY roller_DownCpstChanged FINAL)
    Q_PROPERTY(QString stress01_F_Cpst READ stress01_F_Cpst WRITE setStress01_F_Cpst NOTIFY stress01_F_CpstChanged FINAL)
    Q_PROPERTY(QString stress01_B_Cpst READ stress01_B_Cpst WRITE setStress01_B_Cpst NOTIFY stress01_B_CpstChanged FINAL)
    Q_PROPERTY(QString stress02_F_Cpst READ stress02_F_Cpst WRITE setStress02_F_Cpst NOTIFY stress02_F_CpstChanged FINAL)
    Q_PROPERTY(QString stress02_B_Cpst READ stress02_B_Cpst WRITE setStress02_B_Cpst NOTIFY stress02_B_CpstChanged FINAL)
    Q_PROPERTY(QString stress03_F_Cpst READ stress03_F_Cpst WRITE setStress03_F_Cpst NOTIFY stress03_F_CpstChanged FINAL)
    Q_PROPERTY(QString stress03_B_Cpst READ stress03_B_Cpst WRITE setStress03_B_Cpst NOTIFY stress03_B_CpstChanged FINAL)
    Q_PROPERTY(QString f_knife01_UpCpst READ f_knife01_UpCpst WRITE setF_knife01_UpCpst NOTIFY f_knife01_UpCpstChanged FINAL)
    Q_PROPERTY(QString f_knife01_DownCpst READ f_knife01_DownCpst WRITE setF_knife01_DownCpst NOTIFY f_knife01_DownCpstChanged FINAL)
    Q_PROPERTY(QString f_knife02_UpCpst READ f_knife02_UpCpst WRITE setF_knife02_UpCpst NOTIFY f_knife02_UpCpstChanged FINAL)
    Q_PROPERTY(QString f_knife02_DownCpst READ f_knife02_DownCpst WRITE setF_knife02_DownCpst NOTIFY f_knife02_DownCpstChanged FINAL)
    Q_PROPERTY(QString f_knife03_UpCpst READ f_knife03_UpCpst WRITE setF_knife03_UpCpst NOTIFY f_knife03_UpCpstChanged FINAL)
    Q_PROPERTY(QString f_knife03_DownCpst READ f_knife03_DownCpst WRITE setF_knife03_DownCpst NOTIFY f_knife03_DownCpstChanged FINAL)
    Q_PROPERTY(QString b_knife01_UpCpst READ b_knife01_UpCpst WRITE setB_knife01_UpCpst NOTIFY b_knife01_UpCpstChanged FINAL)
    Q_PROPERTY(QString b_knife01_DownCpst READ b_knife01_DownCpst WRITE setB_knife01_DownCpst NOTIFY b_knife01_DownCpstChanged FINAL)
    Q_PROPERTY(QString b_knife02_UpCpst READ b_knife02_UpCpst WRITE setB_knife02_UpCpst NOTIFY b_knife02_UpCpstChanged FINAL)
    Q_PROPERTY(QString b_knife02_DownCpst READ b_knife02_DownCpst WRITE setB_knife02_DownCpst NOTIFY b_knife02_DownCpstChanged FINAL)
    Q_PROPERTY(QString b_knife03_UpCpst READ b_knife03_UpCpst WRITE setB_knife03_UpCpst NOTIFY b_knife03_UpCpstChanged FINAL)
    Q_PROPERTY(QString b_knife03_DownCpst READ b_knife03_DownCpst WRITE setB_knife03_DownCpst NOTIFY b_knife03_DownCpstChanged FINAL)

    // 报警信息 - 软限位
    Q_PROPERTY(bool knife_Up_SLmt READ knife_Up_SLmt WRITE setKnife_Up_SLmt NOTIFY knife_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool knife_Down_SLmt READ knife_Down_SLmt WRITE setKnife_Down_SLmt NOTIFY knife_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool roller_Up_SLmt READ roller_Up_SLmt WRITE setRoller_Up_SLmt NOTIFY roller_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool roller_Down_SLmt READ roller_Down_SLmt WRITE setRoller_Down_SLmt NOTIFY roller_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool stress01_F_SLmt READ stress01_F_SLmt WRITE setStress01_F_SLmt NOTIFY stress01_F_SLmtChanged FINAL)
    Q_PROPERTY(bool stress01_B_SLmt READ stress01_B_SLmt WRITE setStress01_B_SLmt NOTIFY stress01_B_SLmtChanged FINAL)
    Q_PROPERTY(bool stress02_F_SLmt READ stress02_F_SLmt WRITE setStress02_F_SLmt NOTIFY stress02_F_SLmtChanged FINAL)
    Q_PROPERTY(bool stress02_B_SLmt READ stress02_B_SLmt WRITE setStress02_B_SLmt NOTIFY stress02_B_SLmtChanged FINAL)
    Q_PROPERTY(bool stress03_F_SLmt READ stress03_F_SLmt WRITE setStress03_F_SLmt NOTIFY stress03_F_SLmtChanged FINAL)
    Q_PROPERTY(bool stress03_B_SLmt READ stress03_B_SLmt WRITE setStress03_B_SLmt NOTIFY stress03_B_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife01_Up_SLmt READ f_knife01_Up_SLmt WRITE setF_knife01_Up_SLmt NOTIFY f_knife01_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife01_Down_SLmt READ f_knife01_Down_SLmt WRITE setF_knife01_Down_SLmt NOTIFY f_knife01_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife02_Up_SLmt READ f_knife02_Up_SLmt WRITE setF_knife02_Up_SLmt NOTIFY f_knife02_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife02_Down_SLmt READ f_knife02_Down_SLmt WRITE setF_knife02_Down_SLmt NOTIFY f_knife02_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife03_Up_SLmt READ f_knife03_Up_SLmt WRITE setF_knife03_Up_SLmt NOTIFY f_knife03_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool f_knife03_Down_SLmt READ f_knife03_Down_SLmt WRITE setF_knife03_Down_SLmt NOTIFY f_knife03_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife01_Up_SLmt READ b_knife01_Up_SLmt WRITE setB_knife01_Up_SLmt NOTIFY b_knife01_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife01_Down_SLmt READ b_knife01_Down_SLmt WRITE setB_knife01_Down_SLmt NOTIFY b_knife01_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife02_Up_SLmt READ b_knife02_Up_SLmt WRITE setB_knife02_Up_SLmt NOTIFY b_knife02_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife02_Down_SLmt READ b_knife02_Down_SLmt WRITE setB_knife02_Down_SLmt NOTIFY b_knife02_Down_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife03_Up_SLmt READ b_knife03_Up_SLmt WRITE setB_knife03_Up_SLmt NOTIFY b_knife03_Up_SLmtChanged FINAL)
    Q_PROPERTY(bool b_knife03_Down_SLmt READ b_knife03_Down_SLmt WRITE setB_knife03_Down_SLmt NOTIFY b_knife03_Down_SLmtChanged FINAL)


    // 版本描述
    Q_PROPERTY(QString Version_Description READ Version_Description WRITE setVersion_Description NOTIFY Version_DescriptionChanged FINAL)

    // 扫码枪扫描结果
    Q_PROPERTY(QString scannerResult READ scannerResult WRITE setScannerResult NOTIFY scannerResultChanged FINAL)

    // ListView 记录的报警信息
    Q_PROPERTY(QVariantList vector  NOTIFY vectorChanged)

public:
    // 构造函数
    ConnectManager(QObject *parent = nullptr);
    ConnectManager(const ConnectManager &) = delete;
    ConnectManager(ConnectManager &&) = delete;
    ConnectManager &operator=(const ConnectManager &) = delete;
    ConnectManager &operator=(ConnectManager &&) = delete;
    ~ConnectManager();

    // 获取QML界面输入的各个连接参数
    Q_INVOKABLE void getParamaterFromQML(QString ip,QString port,
                                         QString printerPortName,QString printerBaudRate,QString printerDataBite,QString printerParity,QString printerStopBite,
                                        QString scannerPortName,QString scannerBaudRate,QString scannerDataBite,QString scannerParity,QString scannerStopBite);
    // 将连接设备参数保存到数据库中
    void saveParameterIntoDataBase(QString ip,QString port,
                                   QString printerPortName,QString printerBaudRate,QString printerDataBite,QString printerParity,QString printerStopBite,
                                   QString scannerPortName,QString scannerBaudRate,QString scannerDataBite,QString scannerParity,QString scannerStopBite);



    // 自动界面 - 所选配方参数写入PLC
    Q_INVOKABLE void automaticPanel_OneKeyWriteParameter(QString knife,QString roller,
                                        QString stress01,QString stress02,QString stress03,
                                        QString fwdknife01,QString fwdknife02,QString fwdknife03,
                                         QString backknife01,QString backknife02,QString backknife03);

    // 获取一次当前位置信息   --  未启用  上载功能步骤之一
    Q_INVOKABLE void getCurrentLocationOnce();

    // 写入寄存器(16位数据)
    Q_INVOKABLE void write_modbus_tcp_OneHoldingRegisters(QString address,QString newValue);

    // 写入双字寄存器 (32位数据)
    Q_INVOKABLE void write_modbus_tcp_TwoHoldingResgisters(QString address,QString newValue);

    // 扫描串口信息
    Q_INVOKABLE void scanAvailableInfo();

    // 读取数据库最新一条数据
    void readLastParamter();

    // 打印机 - 打印功能
    Q_INVOKABLE void printerActive(bool flag, QString company, QString nameData, QString numberData,
                                   QString knife, QString roller,
                                   QString stress01, QString stress02, QString stress03,
                                   QString fwdknife01, QString fwdknife02, QString fwdknife03,
                                   QString backknife01, QString backknife02, QString backknife03);

    // 初始化报警数据
    void initWarnData();

    // 刷新新的报警信号
    void readNewWarningData();

    // 接受信号源数据
    void readWarningSignal();

    // 获取详细报警信息
    void getWarningDetailInfo(int index);

    // 保存报警信号信息
    void saveWarningInfo();

    // 遍历历史数据
    void foreachHistory();

    // 定时器
    QTimer* timer = new QTimer();

    QStringList serialInfo() const;
    void setSerialInfo(const QStringList &newSerialInfo);

    bool modbusState() const;
    void setModbusState(bool newModbusState);



    QString knifeCurrLocation() const;
    void setKnifeCurrLocation(const QString &newKnifeCurrLocation);

    QString rollerCurrLocation() const;
    void setRollerCurrLocation(const QString &newRollerCurrLocation);

    QString stress01CurrLocation() const;
    void setStress01CurrLocation(const QString &newStress01CurrLocation);

    QString stress02CurrLocation() const;
    void setStress02CurrLocation(const QString &newStress02CurrLocation);

    QString stress03CurrLocation() const;
    void setStress03CurrLocation(const QString &newStress03CurrLocation);

    QString f_knife01CurrLocation() const;
    void setF_knife01CurrLocation(const QString &newF_knife01CurrLocation);

    QString f_knife02CurrLocation() const;
    void setF_knife02CurrLocation(const QString &newF_knife02CurrLocation);

    QString f_knife03CurrLocation() const;
    void setF_knife03CurrLocation(const QString &newF_knife03CurrLocation);

    QString b_knife01CurrLocation() const;
    void setB_knife01CurrLocation(const QString &newB_knife01CurrLocation);

    QString b_knife02CurrLocation() const;
    void setB_knife02CurrLocation(const QString &newB_knife02CurrLocation);

    QString b_knife03CurrLocation() const;
    void setB_knife03CurrLocation(const QString &newB_knife03CurrLocation);

    int qmlPage() const;
    Q_INVOKABLE void setQmlPage(int newQmlPage);

    QString knifeAimLocation() const;
    void setKnifeAimLocation(const QString &newKnifeAimLocation);

    QString rollerAimLocation() const;
    void setRollerAimLocation(const QString &newRollerAimLocation);

    QString stress01AimLocation() const;
    void setStress01AimLocation(const QString &newStress01AimLocation);

    QString stress02AimLocation() const;
    void setStress02AimLocation(const QString &newStress02AimLocation);

    QString stress03AimLocation() const;
    void setStress03AimLocation(const QString &newStress03AimLocation);

    QString f_knife01AimLocation() const;
    void setF_knife01AimLocation(const QString &newF_knife01AimLocation);

    QString f_knife02AimLocation() const;
    void setF_knife02AimLocation(const QString &newF_knife02AimLocation);

    QString f_knife03AimLocation() const;
    void setF_knife03AimLocation(const QString &newF_knife03AimLocation);

    QString b_knife01AimLocation() const;
    void setB_knife01AimLocation(const QString &newB_knife01AimLocation);

    QString b_knife02AimLocation() const;
    void setB_knife02AimLocation(const QString &newB_knife02AimLocation);

    QString b_knife03AimLocation() const;
    void setB_knife03AimLocation(const QString &newB_knife03AimLocation);

    QString knifeStandby() const;
    void setKnifeStandby(const QString &newKnifeStandby);

    QString rollerStandby() const;
    void setRollerStandby(const QString &newRollerStandby);

    QString stress01Standby() const;
    void setStress01Standby(const QString &newStress01Standby);

    QString stress02Standby() const;
    void setStress02Standby(const QString &newStress02Standby);

    QString stress03Standby() const;
    void setStress03Standby(const QString &newStress03Standby);

    QString f_knife01Standby() const;
    void setF_knife01Standby(const QString &newF_knife01Standby);

    QString f_knife02Standby() const;
    void setF_knife02Standby(const QString &newF_knife02Standby);

    QString f_knife03Standby() const;
    void setF_knife03Standby(const QString &newF_knife03Standby);

    QString b_knife01Standby() const;
    void setB_knife01Standby(const QString &newB_knife01Standby);

    QString b_knife02Standby() const;
    void setB_knife02Standby(const QString &newB_knife02Standby);

    QString b_knife03Standby() const;
    void setB_knife03Standby(const QString &newB_knife03Standby);

    QString knifeLocation() const;
    void setKnifeLocation(const QString &newKnifeLocation);

    QString rollerLocation() const;
    void setRollerLocation(const QString &newRollerLocation);

    QString stress01Location() const;
    void setStress01Location(const QString &newStress01Location);

    QString stress02Location() const;
    void setStress02Location(const QString &newStress02Location);

    QString stress03Location() const;
    void setStress03Location(const QString &newStress03Location);

    QString f_knife01Location() const;
    void setF_knife01Location(const QString &newF_knife01Location);

    QString f_knife02Location() const;
    void setF_knife02Location(const QString &newF_knife02Location);

    QString f_knife03Location() const;
    void setF_knife03Location(const QString &newF_knife03Location);

    QString b_knife01Location() const;
    void setB_knife01Location(const QString &newB_knife01Location);

    QString b_knife02Location() const;
    void setB_knife02Location(const QString &newB_knife02Location);

    QString b_knife03Location() const;
    void setB_knife03Location(const QString &newB_knife03Location);

    QString stress01_ErrCode() const;
    void setStress01_ErrCode(const QString &newStress01_ErrCode);

    QString stress02_ErrCode() const;
    void setStress02_ErrCode(const QString &newStress02_ErrCode);

    QString stress03_ErrCode() const;
    void setStress03_ErrCode(const QString &newStress03_ErrCode);

    QString f_knife01_ErrCode() const;
    void setF_knife01_ErrCode(const QString &newF_knife01_ErrCode);

    QString f_knife02_ErrCode() const;
    void setF_knife02_ErrCode(const QString &newF_knife02_ErrCode);

    QString f_knife03_ErrCode() const;
    void setF_knife03_ErrCode(const QString &newF_knife03_ErrCode);

    QString b_knife01_ErrCode() const;
    void setB_knife01_ErrCode(const QString &newB_knife01_ErrCode);

    QString b_knife02_ErrCode() const;
    void setB_knife02_ErrCode(const QString &newB_knife02_ErrCode);

    QString b_knife03_ErrCode() const;
    void setB_knife03_ErrCode(const QString &newB_knife03_ErrCode);

    bool knifeA() const;
    void setKnifeA(bool newKnifeA);

    bool knifeB() const;
    void setKnifeB(bool newKnifeB);

    bool rollerA() const;
    void setRollerA(bool newRollerA);

    bool rollerB() const;
    void setRollerB(bool newRollerB);

    bool scramBtn() const;
    void setScramBtn(bool newScramBtn);

    bool rollerOrigin() const;
    void setRollerOrigin(bool newRollerOrigin);

    bool knifeUpLmt() const;
    void setKnifeUpLmt(bool newKnifeUpLmt);

    bool knifeDownLmt() const;
    void setKnifeDownLmt(bool newKnifeDownLmt);

    bool transducerWarnning() const;
    void setTransducerWarnning(bool newTransducerWarnning);

    bool knifeUpBtn() const;
    void setKnifeUpBtn(bool newKnifeUpBtn);

    bool knifeDownBtn() const;
    void setKnifeDownBtn(bool newKnifeDownBtn);

    bool rollerUpBtn() const;
    void setRollerUpBtn(bool newRollerUpBtn);

    bool rollerDownBtn() const;
    void setRollerDownBtn(bool newRollerDownBtn);

    bool knifeUpSignal() const;
    void setKnifeUpSignal(bool newKnifeUpSignal);

    bool knifeDownSignal() const;
    void setKnifeDownSignal(bool newKnifeDownSignal);

    bool rollerUpSignal() const;
    void setRollerUpSignal(bool newRollerUpSignal);

    bool rollerDownSignal() const;
    void setRollerDownSignal(bool newRollerDownSignal);

    bool manualControlSignal() const;
    void setManualControlSignal(bool newManualControlSignal);

    bool runningSignal() const;
    void setRunningSignal(bool newRunningSignal);

    bool warnningSignal() const;
    void setWarnningSignal(bool newWarnningSignal);

    QString stressMaunalSpeed() const;
    void setStressMaunalSpeed(const QString &newStressMaunalSpeed);

    QString stressAutoSpeed() const;
    void setStressAutoSpeed(const QString &newStressAutoSpeed);

    QString knifeManualSpeed() const;
    void setKnifeManualSpeed(const QString &newKnifeManualSpeed);

    QString knifeAutoSpeed() const;
    void setKnifeAutoSpeed(const QString &newKnifeAutoSpeed);

    QString b_knife01_Offset() const;
    void setB_knife01_Offset(const QString &newB_knife01_Offset);

    QString b_knife02_Offset() const;
    void setB_knife02_Offset(const QString &newB_knife02_Offset);

    QString b_knife03_Offset() const;
    void setB_knife03_Offset(const QString &newB_knife03_Offset);

    QString knifeOriginLocation() const;
    void setKnifeOriginLocation(const QString &newKnifeOriginLocation);

    QString rollerOriginLocation() const;
    void setRollerOriginLocation(const QString &newRollerOriginLocation);

    QString stress01OriginLocation() const;
    void setStress01OriginLocation(const QString &newStress01OriginLocation);

    QString stress02OriginLocation() const;
    void setStress02OriginLocation(const QString &newStress02OriginLocation);

    QString stress03OriginLocation() const;
    void setStress03OriginLocation(const QString &newStress03OriginLocation);

    QString f_knife01OriginLocation() const;
    void setF_knife01OriginLocation(const QString &newF_knife01OriginLocation);

    QString f_knife02OriginLocation() const;
    void setF_knife02OriginLocation(const QString &newF_knife02OriginLocation);

    QString f_knife03OriginLocation() const;
    void setF_knife03OriginLocation(const QString &newF_knife03OriginLocation);

    QString b_knife01OriginLocation() const;
    void setB_knife01OriginLocation(const QString &newB_knife01OriginLocation);

    QString b_knife02OriginLocation() const;
    void setB_knife02OriginLocation(const QString &newB_knife02OriginLocation);

    QString b_knife03OriginLocation() const;
    void setB_knife03OriginLocation(const QString &newB_knife03OriginLocation);



    QString knifeUpLimit() const;
    void setKnifeUpLimit(const QString &newKnifeUpLimit);

    QString knifeDownLimit() const;
    void setKnifeDownLimit(const QString &newKnifeDownLimit);

    QString rollerUpLimit() const;
    void setRollerUpLimit(const QString &newRollerUpLimit);

    QString rollerDownLimit() const;
    void setRollerDownLimit(const QString &newRollerDownLimit);

    QString stress01_F_Limit() const;
    void setStress01_F_Limit(const QString &newStress01_F_Limit);

    QString stress01_B_Limit() const;
    void setStress01_B_Limit(const QString &newStress01_B_Limit);

    QString stress02_F_Limit() const;
    void setStress02_F_Limit(const QString &newStress02_F_Limit);

    QString stress02_B_Limit() const;
    void setStress02_B_Limit(const QString &newStress02_B_Limit);

    QString stress03_F_Limit() const;
    void setStress03_F_Limit(const QString &newStress03_F_Limit);

    QString stress03_B_Limit() const;
    void setStress03_B_Limit(const QString &newStress03_B_Limit);

    QString f_knife01_UpLimit() const;
    void setF_knife01_UpLimit(const QString &newF_knife01_UpLimit);

    QString f_knife01_DownLimit() const;
    void setF_knife01_DownLimit(const QString &newF_knife01_DownLimit);

    QString f_knife02_UpLimit() const;
    void setF_knife02_UpLimit(const QString &newF_knife02_UpLimit);

    QString f_knife02_DownLimit() const;
    void setF_knife02_DownLimit(const QString &newF_knife02_DownLimit);

    QString f_knife03_UpLimit() const;
    void setF_knife03_UpLimit(const QString &newF_knife03_UpLimit);

    QString f_knife03_DownLimit() const;
    void setF_knife03_DownLimit(const QString &newF_knife03_DownLimit);

    QString b_knife01_UpLimit() const;
    void setB_knife01_UpLimit(const QString &newB_knife01_UpLimit);

    QString b_knife01_DownLimit() const;
    void setB_knife01_DownLimit(const QString &newB_knife01_DownLimit);

    QString b_knife02_UpLimit() const;
    void setB_knife02_UpLimit(const QString &newB_knife02_UpLimit);

    QString b_knife02_DownLimit() const;
    void setB_knife02_DownLimit(const QString &newB_knife02_DownLimit);

    QString b_knife03_UpLimit() const;
    void setB_knife03_UpLimit(const QString &newB_knife03_UpLimit);

    QString b_knife03_DownLimit() const;
    void setB_knife03_DownLimit(const QString &newB_knife03_DownLimit);

    QString knife_UpCpst() const;
    void setKnife_UpCpst(const QString &newKnife_UpCpst);

    QString knife_DownCpst() const;
    void setKnife_DownCpst(const QString &newKnife_DownCpst);

    QString roller_UpCpst() const;
    void setRoller_UpCpst(const QString &newRoller_UpCpst);

    QString roller_DownCpst() const;
    void setRoller_DownCpst(const QString &newRoller_DownCpst);

    QString stress01_F_Cpst() const;
    void setStress01_F_Cpst(const QString &newStress01_F_Cpst);

    QString stress01_B_Cpst() const;
    void setStress01_B_Cpst(const QString &newStress01_B_Cpst);

    QString stress02_F_Cpst() const;
    void setStress02_F_Cpst(const QString &newStress02_F_Cpst);

    QString stress02_B_Cpst() const;
    void setStress02_B_Cpst(const QString &newStress02_B_Cpst);

    QString stress03_F_Cpst() const;
    void setStress03_F_Cpst(const QString &newStress03_F_Cpst);

    QString stress03_B_Cpst() const;
    void setStress03_B_Cpst(const QString &newStress03_B_Cpst);

    QString f_knife01_UpCpst() const;
    void setF_knife01_UpCpst(const QString &newF_knife01_UpCpst);

    QString f_knife01_DownCpst() const;
    void setF_knife01_DownCpst(const QString &newF_knife01_DownCpst);

    QString f_knife02_UpCpst() const;
    void setF_knife02_UpCpst(const QString &newF_knife02_UpCpst);

    QString f_knife02_DownCpst() const;
    void setF_knife02_DownCpst(const QString &newF_knife02_DownCpst);

    QString f_knife03_UpCpst() const;
    void setF_knife03_UpCpst(const QString &newF_knife03_UpCpst);

    QString f_knife03_DownCpst() const;
    void setF_knife03_DownCpst(const QString &newF_knife03_DownCpst);

    QString b_knife01_UpCpst() const;
    void setB_knife01_UpCpst(const QString &newB_knife01_UpCpst);

    QString b_knife01_DownCpst() const;
    void setB_knife01_DownCpst(const QString &newB_knife01_DownCpst);

    QString b_knife02_UpCpst() const;
    void setB_knife02_UpCpst(const QString &newB_knife02_UpCpst);

    QString b_knife02_DownCpst() const;
    void setB_knife02_DownCpst(const QString &newB_knife02_DownCpst);

    QString b_knife03_UpCpst() const;
    void setB_knife03_UpCpst(const QString &newB_knife03_UpCpst);

    QString b_knife03_DownCpst() const;
    void setB_knife03_DownCpst(const QString &newB_knife03_DownCpst);

    QString manualSpeedRate() const;
    void setManualSpeedRate(const QString &newManualSpeedRate);

    QString transducerSpeed() const;
    void setTransducerSpeed(const QString &newTransducerSpeed);

    QString scannerResult() const;
    void setScannerResult(const QString &newScannerResult);

    bool knife_Up_SLmt() const;
    void setKnife_Up_SLmt(bool newKnife_Up_SLmt);

    bool knife_Down_SLmt() const;
    void setKnife_Down_SLmt(bool newKnife_Down_SLmt);

    bool roller_Up_SLmt() const;
    void setRoller_Up_SLmt(bool newRoller_Up_SLmt);

    bool roller_Down_SLmt() const;
    void setRoller_Down_SLmt(bool newRoller_Down_SLmt);

    bool stress01_F_SLmt() const;
    void setStress01_F_SLmt(bool newStress01_F_SLmt);

    bool stress01_B_SLmt() const;
    void setStress01_B_SLmt(bool newStress01_B_SLmt);

    bool stress02_F_SLmt() const;
    void setStress02_F_SLmt(bool newStress02_F_SLmt);

    bool stress02_B_SLmt() const;
    void setStress02_B_SLmt(bool newStress02_B_SLmt);

    bool stress03_F_SLmt() const;
    void setStress03_F_SLmt(bool newStress03_F_SLmt);

    bool stress03_B_SLmt() const;
    void setStress03_B_SLmt(bool newStress03_B_SLmt);

    bool f_knife01_Up_SLmt() const;
    void setF_knife01_Up_SLmt(bool newF_knife01_Up_SLmt);

    bool f_knife01_Down_SLmt() const;
    void setF_knife01_Down_SLmt(bool newF_knife01_Down_SLmt);

    bool f_knife02_Up_SLmt() const;
    void setF_knife02_Up_SLmt(bool newF_knife02_Up_SLmt);

    bool f_knife02_Down_SLmt() const;
    void setF_knife02_Down_SLmt(bool newF_knife02_Down_SLmt);

    bool f_knife03_Up_SLmt() const;
    void setF_knife03_Up_SLmt(bool newF_knife03_Up_SLmt);

    bool f_knife03_Down_SLmt() const;
    void setF_knife03_Down_SLmt(bool newF_knife03_Down_SLmt);

    bool b_knife01_Up_SLmt() const;
    void setB_knife01_Up_SLmt(bool newB_knife01_Up_SLmt);

    bool b_knife01_Down_SLmt() const;
    void setB_knife01_Down_SLmt(bool newB_knife01_Down_SLmt);

    bool b_knife02_Up_SLmt() const;
    void setB_knife02_Up_SLmt(bool newB_knife02_Up_SLmt);

    bool b_knife02_Down_SLmt() const;
    void setB_knife02_Down_SLmt(bool newB_knife02_Down_SLmt);

    bool b_knife03_Up_SLmt() const;
    void setB_knife03_Up_SLmt(bool newB_knife03_Up_SLmt);

    bool b_knife03_Down_SLmt() const;
    void setB_knife03_Down_SLmt(bool newB_knife03_Down_SLmt);



    QString Version_Description() const;
    void setVersion_Description(const QString &newVersion_Description);

signals:
    void serialInfoChanged();
    void modbusStateChanged();





    void knifeCurrLocationChanged();

    void rollerCurrLocationChanged();

    void stress01CurrLocationChanged();

    void stress02CurrLocationChanged();

    void stress03CurrLocationChanged();

    void f_knife01CurrLocationChanged();

    void f_knife02CurrLocationChanged();

    void f_knife03CurrLocationChanged();

    void b_knife01CurrLocationChanged();

    void b_knife02CurrLocationChanged();

    void b_knife03CurrLocationChanged();

    void qmlPageChanged();

    void knifeAimLocationChanged();

    void rollerAimLocationChanged();

    void stress01AimLocationChanged();

    void stress02AimLocationChanged();

    void stress03AimLocationChanged();

    void f_knife01AimLocationChanged();

    void f_knife02AimLocationChanged();

    void f_knife03AimLocationChanged();

    void b_knife01AimLocationChanged();

    void b_knife02AimLocationChanged();

    void b_knife03AimLocationChanged();

    void knifeStandbyChanged();

    void rollerStandbyChanged();

    void stress01StandbyChanged();

    void stress02StandbyChanged();

    void stress03StandbyChanged();

    void f_knife01StandbyChanged();

    void f_knife02StandbyChanged();

    void f_knife03StandbyChanged();

    void b_knife01StandbyChanged();

    void b_knife02StandbyChanged();

    void b_knife03StandbyChanged();

    void knifeLocationChanged();

    void rollerLocationChanged();

    void stress01LocationChanged();

    void stress02LocationChanged();

    void stress03LocationChanged();

    void f_knife01LocationChanged();

    void f_knife02LocationChanged();

    void f_knife03LocationChanged();

    void b_knife01LocationChanged();

    void b_knife02LocationChanged();

    void b_knife03LocationChanged();

    void stress01_ErrCodeChanged();

    void stress02_ErrCodeChanged();

    void stress03_ErrCodeChanged();

    void f_knife01_ErrCodeChanged();

    void f_knife02_ErrCodeChanged();

    void f_knife03_ErrCodeChanged();

    void b_knife01_ErrCodeChanged();

    void b_knife02_ErrCodeChanged();

    void b_knife03_ErrCodeChanged();

    void knifeAChanged();

    void knifeBChanged();

    void rollerAChanged();

    void rollerBChanged();

    void scramBtnChanged();

    void rollerOriginChanged();

    void knifeUpLmtChanged();

    void knifeDownLmtChanged();

    void transducerWarnningChanged();

    void knifeUpBtnChanged();

    void knifeDownBtnChanged();

    void rollerUpBtnChanged();

    void rollerDownBtnChanged();

    void knifeUpSignalChanged();

    void knifeDownSignalChanged();

    void rollerUpSignalChanged();

    void rollerDownSignalChanged();

    void manualControlSignalChanged();

    void runningSignalChanged();

    void warnningSignalChanged();

    void stressMaunalSpeedChanged();

    void stressAutoSpeedChanged();

    void knifeManualSpeedChanged();

    void knifeAutoSpeedChanged();

    void b_knife01_OffsetChanged();

    void b_knife02_OffsetChanged();

    void b_knife03_OffsetChanged();

    void knifeOriginLocationChanged();

    void rollerOriginLocationChanged();

    void stress01OriginLocationChanged();

    void stress02OriginLocationChanged();

    void stress03OriginLocationChanged();

    void f_knife01OriginLocationChanged();

    void f_knife02OriginLocationChanged();

    void f_knife03OriginLocationChanged();

    void b_knife01OriginLocationChanged();

    void b_knife02OriginLocationChanged();

    void b_knife03OriginLocationChanged();



    void knifeUpLimitChanged();

    void knifeDownLimitChanged();

    void rollerUpLimitChanged();

    void rollerDownLimitChanged();

    void stress01_F_LimitChanged();

    void stress01_B_LimitChanged();

    void stress02_F_LimitChanged();

    void stress02_B_LimitChanged();

    void stress03_F_LimitChanged();

    void stress03_B_LimitChanged();

    void f_knife01_UpLimitChanged();

    void f_knife01_DownLimitChanged();

    void f_knife02_UpLimitChanged();

    void f_knife02_DownLimitChanged();

    void f_knife03_UpLimitChanged();

    void f_knife03_DownLimitChanged();

    void b_knife01_UpLimitChanged();

    void b_knife01_DownLimitChanged();

    void b_knife02_UpLimitChanged();

    void b_knife02_DownLimitChanged();

    void b_knife03_UpLimitChanged();

    void b_knife03_DownLimitChanged();

    void knife_UpCpstChanged();

    void knife_DownCpstChanged();

    void roller_UpCpstChanged();

    void roller_DownCpstChanged();

    void stress01_F_CpstChanged();

    void stress01_B_CpstChanged();

    void stress02_F_CpstChanged();

    void stress02_B_CpstChanged();

    void stress03_F_CpstChanged();

    void stress03_B_CpstChanged();

    void f_knife01_UpCpstChanged();

    void f_knife01_DownCpstChanged();

    void f_knife02_UpCpstChanged();

    void f_knife02_DownCpstChanged();

    void f_knife03_UpCpstChanged();

    void f_knife03_DownCpstChanged();

    void b_knife01_UpCpstChanged();

    void b_knife01_DownCpstChanged();

    void b_knife02_UpCpstChanged();

    void b_knife02_DownCpstChanged();

    void b_knife03_UpCpstChanged();

    void b_knife03_DownCpstChanged();

    void manualSpeedRateChanged();

    void transducerSpeedChanged();

    void scannerResultChanged();

    void knife_Up_SLmtChanged();

    void knife_Down_SLmtChanged();

    void roller_Up_SLmtChanged();

    void roller_Down_SLmtChanged();

    void stress01_F_SLmtChanged();

    void stress01_B_SLmtChanged();

    void stress02_F_SLmtChanged();

    void stress02_B_SLmtChanged();

    void stress03_F_SLmtChanged();

    void stress03_B_SLmtChanged();

    void f_knife01_Up_SLmtChanged();

    void f_knife01_Down_SLmtChanged();

    void f_knife02_Up_SLmtChanged();

    void f_knife02_Down_SLmtChanged();

    void f_knife03_Up_SLmtChanged();

    void f_knife03_Down_SLmtChanged();

    void b_knife01_Up_SLmtChanged();

    void b_knife01_Down_SLmtChanged();

    void b_knife02_Up_SLmtChanged();

    void b_knife02_Down_SLmtChanged();

    void b_knife03_Up_SLmtChanged();

    void b_knife03_Down_SLmtChanged();

    // 报警信号变化 - 信号
    void sig_WarningSignalChanged(QString);
    // 报警历史信息变化 - 信号
    void sig_WarningHistoryDataChanged(const QVariantList &vector);

    // 扫码枪发送扫描结果
    void scanResult_Signal(QString p01,QString p02,QString p03,QString p04,QString p05,
                           QString p06,QString p07,QString p08,QString p09,QString p10);


    void Version_DescriptionChanged();

public slots:
    // 定时器响应
    void onTimeOut_Slots();
    // 连接状态
    void onModbusStateChanged_Slots(QModbusDevice::State state);
    // 扫码枪扫描结果
    void onScannerResult_Slots();

    //
private:

    // 扫描到的串口信息
    QStringList m_serialInfo;

    // ModBus 连接对象
    ModbusControl* modbusConnect = new ModbusControl();
    // 打印机 连接对象
    PrinterControl* printerConnect = new PrinterControl();
    // 扫码枪 连接对象
    ScannerControl* scannerConnect = new ScannerControl();
    // 设备参数数据库对象
    QSqlDatabase deviceSql;
    // 连接状态
    bool m_modbusState = false;
    // 页码
    int m_qmlPage;

    // 当前位置
    QString m_knifeCurrLocation;
    QString m_rollerCurrLocation;
    QString m_stress01CurrLocation;
    QString m_stress02CurrLocation;
    QString m_stress03CurrLocation;
    QString m_f_knife01CurrLocation;
    QString m_f_knife02CurrLocation;
    QString m_f_knife03CurrLocation;
    QString m_b_knife01CurrLocation;
    QString m_b_knife02CurrLocation;
    QString m_b_knife03CurrLocation;

    // 目标位置
    QString m_knifeAimLocation;
    QString m_rollerAimLocation;
    QString m_stress01AimLocation;
    QString m_stress02AimLocation;
    QString m_stress03AimLocation;
    QString m_f_knife01AimLocation;
    QString m_f_knife02AimLocation;
    QString m_f_knife03AimLocation;
    QString m_b_knife01AimLocation;
    QString m_b_knife02AimLocation;
    QString m_b_knife03AimLocation;

    // 待命点位置
    QString m_knifeStandby;
    QString m_rollerStandby;
    QString m_stress01Standby;
    QString m_stress02Standby;
    QString m_stress03Standby;
    QString m_f_knife01Standby;
    QString m_f_knife02Standby;
    QString m_f_knife03Standby;
    QString m_b_knife01Standby;
    QString m_b_knife02Standby;
    QString m_b_knife03Standby;

    // 定位位置
    QString m_knifeLocation;
    QString m_rollerLocation;
    QString m_stress01Location;
    QString m_stress02Location;
    QString m_stress03Location;
    QString m_f_knife01Location;
    QString m_f_knife02Location;
    QString m_f_knife03Location;
    QString m_b_knife01Location;
    QString m_b_knife02Location;
    QString m_b_knife03Location;
    QString m_stress01_ErrCode;
    QString m_stress02_ErrCode;
    QString m_stress03_ErrCode;
    QString m_f_knife01_ErrCode;
    QString m_f_knife02_ErrCode;
    QString m_f_knife03_ErrCode;
    QString m_b_knife01_ErrCode;
    QString m_b_knife02_ErrCode;
    QString m_b_knife03_ErrCode;

    // IO输入输出
    bool m_knifeA;
    bool m_knifeB;
    bool m_rollerA;
    bool m_rollerB;
    bool m_scramBtn;
    bool m_rollerOrigin;
    bool m_knifeUpLmt;
    bool m_knifeDownLmt;
    bool m_transducerWarnning;
    bool m_knifeUpBtn;
    bool m_knifeDownBtn;
    bool m_rollerUpBtn;
    bool m_rollerDownBtn;
    bool m_knifeUpSignal;
    bool m_knifeDownSignal;
    bool m_rollerUpSignal;
    bool m_rollerDownSignal;
    bool m_manualControlSignal;
    bool m_runningSignal;
    bool m_warnningSignal;

    // 常用参数 - 手动自动速度
    QString m_stressMaunalSpeed;
    QString m_stressAutoSpeed;
    QString m_knifeManualSpeed;
    QString m_knifeAutoSpeed;

    // 后刀偏移量
    QString m_b_knife01_Offset;
    QString m_b_knife02_Offset;
    QString m_b_knife03_Offset;

    // 原点位置
    QString m_knifeOriginLocation;
    QString m_rollerOriginLocation;
    QString m_stress01OriginLocation;
    QString m_stress02OriginLocation;
    QString m_stress03OriginLocation;
    QString m_f_knife01OriginLocation;
    QString m_f_knife02OriginLocation;
    QString m_f_knife03OriginLocation;
    QString m_b_knife01OriginLocation;
    QString m_b_knife02OriginLocation;
    QString m_b_knife03OriginLocation;

    // 限位位置
    QString m_knifeUpLimit;
    QString m_knifeDownLimit;
    QString m_rollerUpLimit;
    QString m_rollerDownLimit;
    QString m_stress01_F_Limit;
    QString m_stress01_B_Limit;
    QString m_stress02_F_Limit;
    QString m_stress02_B_Limit;
    QString m_stress03_F_Limit;
    QString m_stress03_B_Limit;
    QString m_f_knife01_UpLimit;
    QString m_f_knife01_DownLimit;
    QString m_f_knife02_UpLimit;
    QString m_f_knife02_DownLimit;
    QString m_f_knife03_UpLimit;
    QString m_f_knife03_DownLimit;
    QString m_b_knife01_UpLimit;
    QString m_b_knife01_DownLimit;
    QString m_b_knife02_UpLimit;
    QString m_b_knife02_DownLimit;
    QString m_b_knife03_UpLimit;
    QString m_b_knife03_DownLimit;
    QString m_knife_UpCpst;
    QString m_knife_DownCpst;
    QString m_roller_UpCpst;
    QString m_roller_DownCpst;
    QString m_stress01_F_Cpst;
    QString m_stress01_B_Cpst;
    QString m_stress02_F_Cpst;
    QString m_stress02_B_Cpst;
    QString m_stress03_F_Cpst;
    QString m_stress03_B_Cpst;
    QString m_f_knife01_UpCpst;
    QString m_f_knife01_DownCpst;
    QString m_f_knife02_UpCpst;
    QString m_f_knife02_DownCpst;
    QString m_f_knife03_UpCpst;
    QString m_f_knife03_DownCpst;
    QString m_b_knife01_UpCpst;
    QString m_b_knife01_DownCpst;
    QString m_b_knife02_UpCpst;
    QString m_b_knife02_DownCpst;
    QString m_b_knife03_UpCpst;
    QString m_b_knife03_DownCpst;
    QString m_manualSpeedRate;
    QString m_transducerSpeed;

    // 扫码枪扫描结果
    QString m_scannerResult;

    // 报警信号 - 软限位
    bool m_knife_Up_SLmt;
    bool m_knife_Down_SLmt;
    bool m_roller_Up_SLmt;
    bool m_roller_Down_SLmt;
    bool m_stress01_F_SLmt;
    bool m_stress01_B_SLmt;
    bool m_stress02_F_SLmt;
    bool m_stress02_B_SLmt;
    bool m_stress03_F_SLmt;
    bool m_stress03_B_SLmt;
    bool m_f_knife01_Up_SLmt;
    bool m_f_knife01_Down_SLmt;
    bool m_f_knife02_Up_SLmt;
    bool m_f_knife02_Down_SLmt;
    bool m_f_knife03_Up_SLmt;
    bool m_f_knife03_Down_SLmt;
    bool m_b_knife01_Up_SLmt;
    bool m_b_knife01_Down_SLmt;
    bool m_b_knife02_Up_SLmt;
    bool m_b_knife02_Down_SLmt;
    bool m_b_knife03_Up_SLmt;
    bool m_b_knife03_Down_SLmt;

    // 报警历史记录
    QVector<WARNSIGNALINFO> m_warnHistory;

    // 记录原有报警数据
    QVector<bool> m_warnVector;

    // 记录新接收的报警数据
    QVector<bool> m_newWarnVector;

    // 报警信号
    QString m_warnInfo;

    // 接收报警信息的详细描述
    QMap<int,QString> m_warnDetail;

    QString m_Version_Description;
};

#endif // CONNECTMANAGER_H
